<template>
  <div>
    <van-nav-bar title="列表" left-text="返回" left-arrow @click-left="onClickLeft" />
    <template v-for="item in goods">
      <van-card
      :key='item.id'
        num="1"
        :price="item.price"
        desc="描述信息"
        :title="item.goodsname"
        :thumb="$pregImg+item.img"
        @click="detail(item.id)"
      />
    </template>
  </div>
</template>

<script>
export default {
  data() {
    return {
      goods: []
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
     detail(id){
      this.$router.push(`/goodsdetail?id=${id}`)
  }
  },
  mounted() {
    this.goods = JSON.parse(this.$route.query.id);
    // console.log(this.goods);
  }
};
</script>

<style>
</style>